
[m,n]=size(xbin);
x2=ones(m,n);
for j=1:n
    con=length(find(xbin(:,j)==0));
    if con ~= 0
        for i=m:-1:(m-con)
            x2(i,j)=0;
        end
    end
end
figure;
imshow(x2);